/**
 * 智能提示指令
 */
import tem from './index.html'
class examineCtrl {
  constructor($scope,$location,http) {
      //查看订单参数
      $scope.searchData = $location.search()
      //初始化接参对象
      //$scope.param1={}
      console.log("查看订单参数------",$scope.searchData)
      if($scope.searchData.oid && $scope.searchData.pid){
           http.post('selectOrderInfo.do', {oid:$scope.searchData.oid, pid:$scope.searchData.pid,s_id:$scope.searchData.s_id}, function (data) {
                  console.log(data)
                  if(data.errcode ==1){
	                  $scope.$apply(function(){
	                  	  $scope.data=data.data;//订单信息
	                      //借款信息
	                      $scope.data1=data.data.order;
	                      console.log("借款信息",$scope.data1)
	                      //费用明细
	                      $scope.data2=data.data.fee;
	                      console.log("费用明细",$scope.data2)
	                      //借款人基本信息
	                      $scope.data3=data.data.person;
	                       console.log("借款人基本信息",$scope.data3)
	                      //主借款人信息
	                      $scope.data4=data.data.person[0]
	                      console.log("主借款人信息",$scope.data4);
	                      //公司信息
	                      $scope.data5=data.data.company;
	                      console.log("公司信息",$scope.data5);
	                      //判断是否填写公司信息
	                      $scope.showCompany=0
	                      for(let i in $scope.data5){
	                        if($scope.data5[i]){
	                          	$scope.showCompany++
	                        }
	                      }
	                      console.log($scope.showCompany)
	                      
	                      //车信息
	                      $scope.data6=data.data.car;
	                      console.log("车信息",$scope.data6);
	                      //判断是否填写车信息
	                      $scope.showCar=0
	                      for(let i in $scope.data6){
	                        if($scope.data6[i]){
	                          	$scope.showCar++
	                        }
	                      }
	                      console.log($scope.showCar)
	                      
	                      //房产信息
	                      $scope.data7=data.data.housing;
	                      console.log("车信息",$scope.data7);
	                      //判断是否填写车信息
	                      $scope.showHousing=0
	                      for(let i in $scope.data7){
	                        if($scope.data7[i]){
	                          	$scope.showHousing++
	                        }
	                      }
	                      console.log($scope.showHousing)
	                      
	                      //房产权利人
	                      $scope.data8=data.data.propertyPersonalList;
	                      console.log("房产权利人",$scope.data8);
	                     
	                     //联系人信息
	                      $scope.data9=data.data.linkMan;
	                      console.log("联系人信息",$scope.data9);
	                      //判断是否填写车信息
	                      $scope.showLinkMan=0
	                      for(let i in $scope.data9){
	                        if($scope.data9[i]){
	                          	$scope.showLinkMan++
	                        }
	                      }
	                      console.log($scope.showLinkMan)
	                      
	                      //其他联系人
	                      $scope.data10=data.data.otherLinkMan;
	                      console.log("其他联系人",$scope.data10);
	                      
	                      //公司地址
	                      $scope.data11=data.data.company_city
	                      if($scope.data11 && $scope.data11.addr_province){
	                      		$scope.diZhi1=$scope.data11.addr_province+$scope.data11.addr_city+$scope.data11.addr_area
	                      }
	                      //房产地址
	                      $scope.data12=data.data.housing_city
	                      if($scope.data12 && $scope.data12.house_addr_province){
	                      		$scope.diZhi2=$scope.data12.house_addr_province+$scope.data12.house_addr_city+$scope.data12.house_addr_area
	                      }
	                      //联系人地址
	                      $scope.data13=data.data.linkMan_city
	                      if($scope.data13 && $scope.data13.linkMan_addr_province){
	                      		$scope.diZhi3=$scope.data13.linkMan_addr_province+$scope.data13.linkMan_addr_province+$scope.data13.linkMan_addr_area
	                      }
	                      //客户户口地址地址
	                      $scope.data14=data.data.personalAddress.personal_city1
	                      if($scope.data14 && $scope.data14.personal_house_addr_province1){
	                      		$scope.diZhi4=$scope.data14.personal_house_addr_province1+$scope.data14.personal_house_addr_city1+$scope.data14.personal_house_addr_area1
	                      }
	                      //客户居住地址
	                      $scope.data15=data.data.personalAddress.personal_city2
	                      if($scope.data15 && $scope.data15.personal_house_addr_province2){
	                      		$scope.diZhi5=$scope.data15.personal_house_addr_province2+$scope.data15.personal_house_addr_city2+$scope.data15.personal_house_addr_area2
	                      }
	                  })
                  }
                  
            })
       }
  }
}

examineCtrl.$inject = ['$scope','$location','http']
module.exports = angular.module('directive.examine', []).directive('examine', function() {
    return {
        template: tem,
        replace:true,
        scope: {
            city: '='
        },
        controller: examineCtrl
    }
}).name